#include "client.h"

int main(int argc, char* argv[]){
    ARGS_CHECK(argc,3);
    //获取传输类型
    char trans_method[10] = {0};
    char file_name[10] = {0};
    //将传输类型存储起来
    memcpy(trans_method,argv[1],strlen(argv[1]));
    //存储文件名
    memcpy(file_name,argv[2],strlen(argv[2]));

    int sockfd;
    init_socket(&sockfd,"8080","192.168.52.128");

    if(strcmp(trans_method,"download") == 0){
        //说明当前是下载文件操作
        download_file(sockfd,file_name,trans_method);
    }else if(strcmp(trans_method,"upload") == 0){
        //当前是上传文件操作
        upload_file(sockfd,file_name,trans_method);
    }else{
        printf("未知操作...\n");
        close(sockfd);
        exit(0);
    }
    close(sockfd);
    return 0;
}

